#include "vgcoreminimal.h"
#include "vglunchengineloop.h"
#include "Core/vcoreglobal.h"

#ifdef _WIN32
#include <crtdbg.h>
#endif


// 定义日志类别 - 只保留定义，实现在VGCoreMinimal中
DEFINE_LOG_CATEGORY(LogTemp)

// GPU优选设置 - 优先使用高性能GPU
extern "C" { __declspec(dllexport) quint32 NvOptimusEnablement = 0x00000001; }
extern "C" { __declspec(dllexport) quint32 AmdPowerXpressRequestHighPerformance = 0x00000001; }

// 前向声明
extern qint32 VGGuardedMain(int argc, char* argv[]);
extern void LaunchWindowsShutdown();

/**
 * Qt应用程序启动包装器
 */
qint32 LaunchWindowsStartup(int argc, char* argv[])
{
    qint32 ErrorLevel = 0;

    // 运行引擎主逻辑
    ErrorLevel = VGGuardedMain(argc, argv);
    
    return ErrorLevel;
}

/**
 * Windows平台退出处理
 */
void LaunchWindowsShutdown()
{
}

/**
 * Qt主函数入口点
 */
int main(int argc, char *argv[])
{
    qint32 Result = LaunchWindowsStartup(argc, argv);
    LaunchWindowsShutdown();
    return Result;
}
